package com.lizhi.yun.core.user.controller;/**
 * @program: spring-boot
 * @name UppUserController
 * @description: 用户controller
 * @author: lizhi
 * @create: 2020-04-13 09:57
 */

import com.lizhi.common.yun.entity.ListResponseResult;
import com.lizhi.yun.db.pojo.UppUserPOJO;
import com.lizhi.yun.core.user.handler.UppUserHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 *@program: spring-boot
 *@name UppUserController
 *@description: 用户controller
 *@author: lizhi
 *@create: 2020-04-13 09:57
 */
@Slf4j
@RestController
@RequestMapping(path = "/api/upp/user")
public class UppUserController {

    @Resource
    private UppUserHandler uppUserHandler;

    @PostMapping(path = "/doMain")
    public ListResponseResult doMain(@RequestParam Map<String, Object> map) {
        log.info("******进入用户信息查询map:{}******", map);
        return uppUserHandler.doMain(map);
    }

    @PostMapping(path = "/doAdd")
    public ListResponseResult doAdd(@RequestBody UppUserPOJO uppUserPOJO){
        return uppUserHandler.doAdd(uppUserPOJO);
    }

    @PostMapping(path = "/doUpdate")
    public ListResponseResult doUpdate(@RequestBody UppUserPOJO uppUserPOJO){
        return uppUserHandler.doUpdate(uppUserPOJO);
    }

    @DeleteMapping(path = "/doDelete")
    public ListResponseResult doDelete(String userAcct){
        return uppUserHandler.doDelete(userAcct);
    }

    @PostMapping(path = "/isNotExists")
    public ListResponseResult isNotExists(String userAcct) {
        return uppUserHandler.isNotExists(userAcct);
    }

    @PostMapping(path = "/selectByAcct")
    public ListResponseResult findUppUserById(String userAcct) {
        return uppUserHandler.findById(userAcct);
    }

    @PostMapping(path = "/checkPwd")
    public ListResponseResult checkPwd(String userPwd, String userAcct) {
        return uppUserHandler.checkPwd(userPwd,userAcct);
    }

    @PostMapping(path = "/updatePwd")
    public ListResponseResult updatePwd(String oldPassword, String newPassword, String userAcct) {
        return uppUserHandler.updatePwd(oldPassword, newPassword,userAcct);
    }

    @PostMapping(path = "/resetPWD")
    public ListResponseResult resetPWD(String userAcct) {
        return uppUserHandler.resetPwd(userAcct);
    }

    @GetMapping(path = "/getPhysicians")
    public ListResponseResult getPhysicians(){
        return uppUserHandler.getPhysicians();
    }
}
